package com.whfc.wxmp.api.fim.controller;

import com.whfc.common.result.ListData;
import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.wxmp.annotation.CurrentWxUser;
import com.whfc.fuum.entity.WxUser;
import com.whfc.fim.dto.FimAlgCheckTypeDTO;
import com.whfc.wxmp.api.fim.service.WxFimWarnRuleService;
import com.whfc.wxmp.util.RequestConetxtUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 智能监控-报警类型
 *
 * @author : qzexing
 * @version : 1.0
 * @date : 2020/5/27 15:01
 */
@RestController
@RequestMapping("/mp/api/fim/algCheckType")
public class WxFimAlgCheckTypeController {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private WxFimWarnRuleService wxFimWarnRuleService;

    @GetMapping("/list")
    public Result list(@CurrentWxUser WxUser wxUser,
                       @RequestParam("deptId") Integer deptId) {
        logger.info("WXMPUA|{}|{}|{}|{}|{}",
                wxUser.getId(), RequestConetxtUtil.getAppType(), RequestConetxtUtil.getPage(),
                "获取报警类型列表", "{\"deptId\":\"" + deptId + "\"}");
        List<FimAlgCheckTypeDTO> list = wxFimWarnRuleService.listAlgCheckType(deptId);
        return ResultUtil.success(new ListData<>(list));
    }

}
